from django.db import models
from utils.BaseModel import BaseModel


# Create your models here.
class Users(BaseModel):
    username = models.CharField(max_length=32, unique=False, verbose_name='用户名')
    password = models.CharField(max_length=32, verbose_name='密码')
    phone = models.CharField(max_length=11, unique=True, verbose_name='手机号')
    email = models.EmailField(max_length=32, unique=True, verbose_name='邮箱')
    avatar = models.ImageField(upload_to='avatar', default='avatar/default.jpg', verbose_name='头像')
    gender = models.CharField(max_length=1,default='0', choices=(('0', '男'), ('1', '女')), verbose_name='性别')
    level = models.CharField(max_length=1,default='0', choices=(('0', '普通'), ('1', 'VIP'), ('2', 'SVIP')), verbose_name='等级')
    score = models.IntegerField(default=0, verbose_name='积分')

    def __str__(self):
        return self.username

    class Meta:
        db_table = 'user'

